/*
 * @Description: 生成Pages路由
 * @Author: DHL
 * @Date: 2022-01-30 14:20:12
 * @LastEditors: DHL
 * @LastEditTime: 2023-02-22 14:03:20
 */

import { firstToUpperCase, firstToLowerCase } from '../../utils/codeGenUtils'

export function createUniappPages(codeGenConfig: any) {
  const classNameFirstToUpperCase = firstToUpperCase(codeGenConfig.className)
  const classNameFirstToLowerCase = firstToLowerCase(codeGenConfig.className)

  return `
  /**
   * ${codeGenConfig.genName}
   */
  export default [
    {
      name: '${classNameFirstToLowerCase}',
      path: 'pages/${classNameFirstToLowerCase}/index',
      style: {
        navigationBarTitleText: '${codeGenConfig.genName}'
      }
    },
    {
      name: '${classNameFirstToLowerCase}Form',
      path: 'pages/${classNameFirstToLowerCase}/form',
      style: {
        navigationBarTitleText: '${codeGenConfig.genName}表单'
      }
    }
  ] as any
`
}
